package com.company.nowcoder;

public class 牛妹的蛋糕 {

    public static void main(String[] args) {
        System.out.println(cakeNumber(4));
    }

    public static int cakeNumber (int n) {
        // write code here
        if (n == 0) return 0;
        int[] dp = new int[n];
        dp[n - 1] = 1;
        for (int i = dp.length - 1; i > 0; i--) {
            dp[i - 1] = (dp[i] + 1) * 3 / 2;
        }

        return dp[0];
    }

}
